package com.gz.gzspringboot;

import org.apache.catalina.LifecycleException;
import org.apache.catalina.startup.Tomcat;

public class GzSpringApplication {

    //创建tomcat对象，并关联Spring容器，启动
    public static void run(){
        try {
            Tomcat tomcat = new Tomcat();
            //让tomcat可以将请求钻发到springweb容器
            //因此需要进行关联
            // /gzboot就原是生tomcat的application context即http://localhost:9090/gzboot/
            tomcat.addWebapp("/gzboot","E:\\Java\\java_code\\framwork\\gz-springboot");
            tomcat.setPort(9090);
            tomcat.start();
            System.out.println("========9090等待请求=========");
            tomcat.getServer().await();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
